package com.BraveY.Demo02;

import java.util.Scanner;

public class Demo05 {
    public static void main(String[] args) {
        int [] arr = new int[5];
        Scanner s = new Scanner(System.in);
        for (int i = 0; i < arr.length ; i++) {
            System.out.println("请输入第"+ (i+ 1) + "个数：");
            arr[i] = s.nextInt();
        }
        System.out.println("您输入的数组为：");
        System.out.print("[");
        for (int i = 0; i <arr.length ; i++) {
           if(i == arr.length - 1){
               System.out.println(arr[i] +"]" );
           } else {
               System.out.print(arr[i] + ",");
           }
        }

        for(int start = 0, end = arr.length-1;start<end; start++,end--){
            int tem = arr[start];
            arr[start] = arr[end];
            arr[end] = tem;
        }
        System.out.println("您反转后的数组为：");
        System.out.print("[");
        for (int i = 0; i <arr.length ; i++) {
            if(i == arr.length - 1){
                System.out.println(arr[i] +"]" );
            } else {
                System.out.print(arr[i] + ",");
            }
        }
        System.out.println("谢谢使用！");
    }
}
